

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>5.5. DCD trajectory I/O — MDAnalysis.coordinates.DCD &mdash; MDAnalysis v0.7.5-devel documentation</title>
    <link rel="stylesheet" href="../../_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.7.5-devel',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within MDAnalysis v0.7.5-devel documentation"
          href="../../_static/opensearch.xml"/>
    <link rel="shortcut icon" href="../../_static/mdanalysis-logo.ico"/>
    <link rel="top" title="MDAnalysis v0.7.5-devel documentation" href="../../index.html" />
    <link rel="up" title="5. Coordinates modules" href="../coordinates_modules.html" />
    <link rel="next" title="5.6. GRO file format — MDAnalysis.coordinates.GRO" href="GRO.html" />
    <link rel="prev" title="5.4. CRD structure files in MDAnalysis — MDAnalysis.coordinates.CRD" href="CRD.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="GRO.html" title="5.6. GRO file format — MDAnalysis.coordinates.GRO"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="CRD.html" title="5.4. CRD structure files in MDAnalysis — MDAnalysis.coordinates.CRD"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../coordinates_modules.html" accesskey="U">5. Coordinates modules</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/mdanalysis-logo-200x150.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="CRD.html"
                        title="previous chapter">5.4. CRD structure files in MDAnalysis &#8212; <tt class="docutils literal"><span class="pre">MDAnalysis.coordinates.CRD</span></tt></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="GRO.html"
                        title="next chapter">5.6. GRO file format &#8212; <tt class="docutils literal"><span class="pre">MDAnalysis.coordinates.GRO</span></tt></a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/documentation_pages/coordinates/DCD.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-MDAnalysis.coordinates.DCD"></span><div class="section" id="dcd-trajectory-i-o-mdanalysis-coordinates-dcd">
<h1>5.5. DCD trajectory I/O  &#8212; <a class="reference internal" href="#module-MDAnalysis.coordinates.DCD" title="MDAnalysis.coordinates.DCD"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.coordinates.DCD</span></tt></a><a class="headerlink" href="#dcd-trajectory-i-o-mdanalysis-coordinates-dcd" title="Permalink to this headline">¶</a></h1>
<p>Classes to read and write CHARMM/LAMMPS DCD binary
trajectories. Trajectories can be read regardless of system-endianness
as this is auto-detected.</p>
<p>The classes in this module are the reference implementations for the
Trajectory API.</p>
<dl class="class">
<dt id="MDAnalysis.coordinates.DCD.DCDReader">
<em class="property">class </em><tt class="descclassname">MDAnalysis.coordinates.DCD.</tt><tt class="descname">DCDReader</tt><big>(</big><em>dcdfilename</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#MDAnalysis.coordinates.DCD.DCDReader" title="Permalink to this definition">¶</a></dt>
<dd><p>Reads from a DCD file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Data :</th><td class="field-body"><dl class="first docutils">
<dt>ts</dt>
<dd><p class="first last"><a class="reference internal" href="base.html#MDAnalysis.coordinates.base.Timestep" title="MDAnalysis.coordinates.base.Timestep"><tt class="xref py py-class docutils literal"><span class="pre">Timestep</span></tt></a> object
containing coordinates of current frame</p>
</dd>
</dl>
</td>
</tr>
<tr class="field"><th class="field-name">Methods :</th><td class="field-body"><dl class="first last docutils">
<dt><tt class="docutils literal"><span class="pre">dcd</span> <span class="pre">=</span> <span class="pre">DCD(dcdfilename)</span></tt></dt>
<dd><p class="first last">open dcd file and read header</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">len(dcd)</span></tt></dt>
<dd><p class="first last">return number of frames in dcd</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">for</span> <span class="pre">ts</span> <span class="pre">in</span> <span class="pre">dcd:</span></tt></dt>
<dd><p class="first last">iterate through trajectory</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">for</span> <span class="pre">ts</span> <span class="pre">in</span> <span class="pre">dcd[start:stop:skip]:</span></tt></dt>
<dd><p class="first last">iterate through a trajectory</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">dcd[i]</span></tt></dt>
<dd><p class="first last">random access into the trajectory (i corresponds to frame number)</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">data</span> <span class="pre">=</span> <span class="pre">dcd.timeseries(...)</span></tt></dt>
<dd><p class="first last">retrieve a subset of coordinate information for a group of atoms</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">data</span> <span class="pre">=</span> <span class="pre">dcd.correl(...)</span></tt></dt>
<dd><p class="first last">populate a <tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.core.Timeseries.Collection</span></tt> object with computed timeseries</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="MDAnalysis.coordinates.DCD.DCDReader.Writer">
<tt class="descname">Writer</tt><big>(</big><em>filename</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#MDAnalysis.coordinates.DCD.DCDReader.Writer" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a DCDWriter for <em>filename</em> with the same parameters as this DCD.</p>
<p>All values can be changed through keyword arguments.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first docutils">
<dt><em>filename</em></dt>
<dd><p class="first last">filename of the output DCD trajectory</p>
</dd>
</dl>
</td>
</tr>
<tr class="field"><th class="field-name">Keywords :</th><td class="field-body"><dl class="first docutils">
<dt><em>numatoms</em></dt>
<dd><p class="first last">number of atoms</p>
</dd>
<dt><em>start</em></dt>
<dd><p class="first last">number of the first recorded MD step</p>
</dd>
<dt><em>step</em></dt>
<dd><p class="first last">indicate that <em>step</em> MD steps (!) make up one trajectory frame</p>
</dd>
<dt><em>delta</em></dt>
<dd><p class="first last">MD integrator time step (!), in AKMA units</p>
</dd>
<dt><em>remarks</em></dt>
<dd><p class="first last">string that is stored in the DCD header [XXX &#8211; max length?]</p>
</dd>
</dl>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#MDAnalysis.coordinates.DCD.DCDWriter" title="MDAnalysis.coordinates.DCD.DCDWriter"><tt class="xref py py-class docutils literal"><span class="pre">DCDWriter</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The keyword arguments set the low-level attributes of the DCD
according to the CHARMM format. The time between two frames would be
<em>delta</em> * <em>step</em> !</p>
</div>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.coordinates.DCD.DCDReader.correl">
<tt class="descname">correl</tt><big>(</big><em>timeseries</em>, <em>start=0</em>, <em>stop=-1</em>, <em>skip=1</em><big>)</big><a class="headerlink" href="#MDAnalysis.coordinates.DCD.DCDReader.correl" title="Permalink to this definition">¶</a></dt>
<dd><p>Populate a TimeseriesCollection object with timeseries computed from the trajectory</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first last docutils">
<dt><em>timeseries</em></dt>
<dd><p class="first last"><a class="reference internal" href="../core/Timeseries.html#MDAnalysis.core.Timeseries.TimeseriesCollection" title="MDAnalysis.core.Timeseries.TimeseriesCollection"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.core.Timeseries.TimeseriesCollection</span></tt></a></p>
</dd>
<dt><em>start, stop, skip</em></dt>
<dd><p class="first last">subset of trajectory to use, with start and stop being inclusive</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.coordinates.DCD.DCDReader.timeseries">
<tt class="descname">timeseries</tt><big>(</big><em>asel</em>, <em>start=0</em>, <em>stop=-1</em>, <em>skip=1</em>, <em>format='afc'</em><big>)</big><a class="headerlink" href="#MDAnalysis.coordinates.DCD.DCDReader.timeseries" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a subset of coordinate data for an AtomGroup</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first last docutils">
<dt><em>asel</em></dt>
<dd><p class="first last"><a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.AtomGroup" title="MDAnalysis.core.AtomGroup.AtomGroup"><tt class="xref py py-class docutils literal"><span class="pre">AtomGroup</span></tt></a> object</p>
</dd>
<dt><em>start, stop, skip</em></dt>
<dd><p class="first last">range of trajectory to access, start and stop are inclusive</p>
</dd>
<dt><em>format</em></dt>
<dd><p class="first last">the order/shape of the return data array, corresponding
to (a)tom, (f)rame, (c)oordinates all six combinations
of &#8216;a&#8217;, &#8216;f&#8217;, &#8216;c&#8217; are allowed ie &#8220;fac&#8221; - return array
where the shape is (frame, number of atoms,
coordinates)</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="MDAnalysis.coordinates.DCD.DCDWriter">
<em class="property">class </em><tt class="descclassname">MDAnalysis.coordinates.DCD.</tt><tt class="descname">DCDWriter</tt><big>(</big><em>filename</em>, <em>numatoms</em>, <em>start=0</em>, <em>step=1</em>, <em>delta=1.0</em>, <em>remarks='Created by DCDWriter'</em>, <em>convert_units=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.coordinates.DCD.DCDWriter" title="Permalink to this definition">¶</a></dt>
<dd><p>Writes to a DCD file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Methods :</th><td class="field-body"><tt class="docutils literal"><span class="pre">d</span> <span class="pre">=</span> <span class="pre">DCDWriter(dcdfilename,</span> <span class="pre">numatoms,</span> <span class="pre">start,</span> <span class="pre">step,</span> <span class="pre">delta,</span> <span class="pre">remarks)</span></tt></td>
</tr>
</tbody>
</table>
<p>Create a new DCDWriter</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first last docutils">
<dt><em>filename</em></dt>
<dd><p class="first last">name of output file</p>
</dd>
<dt><em>numatoms</em></dt>
<dd><p class="first last">number of atoms in dcd file</p>
</dd>
<dt><em>start</em></dt>
<dd><p class="first last">starting timestep</p>
</dd>
<dt><em>step</em></dt>
<dd><p class="first last">skip between subsequent timesteps</p>
</dd>
<dt><em>delta</em></dt>
<dd><p class="first last">timestep</p>
</dd>
<dt><em>remarks</em></dt>
<dd><p class="first last">comments to annotate dcd file</p>
</dd>
<dt><em>convert_units</em></dt>
<dd><p class="first last">units are converted to the MDAnalysis base format; <tt class="xref docutils literal"><span class="pre">None</span></tt> selects
the value of :data:<a href="#id1"><span class="problematic" id="id2">`</span></a>MDAnalysis.core.flags`[&#8216;convert_gromacs_lengths&#8217;]</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="MDAnalysis.coordinates.DCD.DCDWriter.write_next_timestep">
<tt class="descname">write_next_timestep</tt><big>(</big><em>ts=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.coordinates.DCD.DCDWriter.write_next_timestep" title="Permalink to this definition">¶</a></dt>
<dd><p>write a new timestep to the dcd file</p>
<p>ts - timestep object containing coordinates to be written to dcd file</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="GRO.html" title="5.6. GRO file format — MDAnalysis.coordinates.GRO"
             >next</a> |</li>
        <li class="right" >
          <a href="CRD.html" title="5.4. CRD structure files in MDAnalysis — MDAnalysis.coordinates.CRD"
             >previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../coordinates_modules.html" >5. Coordinates modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2005-2011, Naveen Michaud-Agrawal, Elizabeth J. Denning, Joshua Adelman,
    Christian Beckstein (logo), David Caplan, Jan Domański, Philip Fowler,
    Joseph Goose, Benjamin Hall, Danny Parton, Tyler Reddy, Paul Rigor,
    and Oliver Beckstein.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>